VtScale


Create a Scale widget

Syntax

VtScale object_name [options]

Description

Creates a scale which consists of a bar with a graphical representation that shows the current numerical value of the field. Returns the widget name.

Options

-callback cmd (C)
Called when the value of the scale is changed. The value of the scale at the time of the callback will be passed as part of the callback data.

Additional callback keys

value
value of the scale

-horizontal (CS)
Sets the orientation to horizontal.

-length integer (CS)
Sets the length of the scale (specified in number of characters) to integer characters (in the character environment). In the graphical environment, sets the length of the scale to integer multiplied by the maximum font width.

-max integer (CSG)
Sets the maximum value that a scale can have.

-min integer (CSG)
Sets the minimum value that a scale can have.

-readOnly (C)
If present, the slider is disabled.

-showValue boolean (CSG)
When TRUE (the default), the scale's value is shown above the scale.

-title string (CS)
Sets the title string displayed at the bottom of the scale.

-value integer (CSG)
Sets the current value (restricted in range from min to max.)

-vertical (CS)
Sets the orientation to vertical.

Example

The following code produces a Scale with a minimum value of 0, a maximum value of 100, and a default setting of 73. An appropriate title is also displayed.

set app [VtOpen scale]

set form [VtFormDialog $app.form -title "VtScale Demo" ]

VtScale $form.scale \
        -min 0 \
        -max 100 \
        -value 73 \
        -title "Average number of kumquats\
         \nconsumed per houshold in 1974"

VtShow $form
VtMainLoop

This code produces the following:

See also: